<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>history对象2</title>
</head>
<body>
    <button id="forward">前进</button>
    <button id="back">后退</button>
    <button id="go">go</button>
</body>
    <script>
        /*
        window.history
        可以省略前面的window
        */
        var back = document.getElementById("back");
        var go = document.getElementById("go");
        var forward = document.getElementById("forward");
        back.onclick = function(){
            history.back();
        }
        forward.onclick = function(){
            history.forward();
        }
        go.onclick = function(){
            history.go(-1);
            //值为0时 可刷新当前页面，若为负数则后退
            //若为正数则前进
        }
    </script>
</html>